<template>
	<view class="container">
		<view class="content">
			<view class="xjs-ml-32 xjs-mr-32">
				<view class="xjs-size-32 xjs-weight-bold xjs-pt-40 linehei1">拒绝原因</view>
				<view class="tips_text linehei1">告诉TA不通过成为陪宠师的原因，300字以内。</view>
				<textarea v-model="dataGet.remark" maxlength="300" :adjust-position="true" :show-confirm-bar="false" class="textarea_box" placeholder="请输入拒绝原因"></textarea>
			</view>
		</view>
		<view @tap="submitBtn" class="submit_btn">提交</view>
	</view>
</template>

<script setup lang="ts">
	import { reactive, ref } from 'vue';
	import { onShow , onLoad } from '@dcloudio/uni-app'
	import api from '@/api'
	const dataGet = reactive<{
		id:number | string
		remark:''
	}>({
		id:'',
		remark:''
	})
	//提交
	const submitBtn = async () => {
		if(!dataGet.remark){
			uni.showToast({
				title: '请输入拒绝原因',
				icon: 'none'
			})
			return
		}
		const res : any = await api({
			method: 'post',
			url: `/mall/exam/exam-record/approval`,
			data:{
				reason:dataGet.remark,
				id:dataGet.id,
				type:3
			}
		})
		if(res.code=='0'){
			dataGet.remark = ''
			uni.showToast({
				title: '拒绝成功',
				icon: 'none'
			})
			setTimeout(()=>{
				uni.navigateBack()
			},1000)
			
		}else{
			uni.showToast({
				title: res.msg,
				icon: 'none'
			})
		}
	}
	onLoad((e)=>{
		dataGet.id = e.id
	})
	onShow(() => {
		
	})
</script>

<style lang="scss" scoped>
	.linehei1{
		line-height: 1;
	}
	.content{
		width: 686rpx;
		margin: 32rpx auto;
		background: #FFFFFF;
		border-radius: 24rpx;
		.tips_text{
			color: #7C807F;
			font-size: 26rpx;
			margin-top: 16rpx;
			margin-bottom: 32rpx;
		}
		.textarea_box{
			display: block;
			width: 558rpx;
			height: 622rpx;
			line-height: 1.5;
			background: #F9F6F6;
			border-radius: 16rpx ;
			font-size: 30rpx;
			padding: 32rpx;
		}
		.image_list{
			margin-top: 40rpx;
		}
		.image_list image{
			width: 160rpx;
			height: 213rpx;
			background: #F9F6F6;
			border-radius: 16rpx ;
		}
		.img_tip{
			color: #7C807F;
			padding-bottom: 40rpx;
			padding-top: 24rpx;
			font-size: 24rpx;
		}
		
	}
	.submit_btn{
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		background: linear-gradient( 90deg, #FF6188 0%, #FF5252 100%);
		border-radius: 62rpx;
		margin: 24rpx auto;
		color: #FFFFFF;
		font-size: 28rpx;
		text-align: center;
	}
</style>